/*
 *    Copyright (c) 2018-2025, lengleng All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: lengleng (wangiegie@gmail.com)
 */

package com.pig4cloud.pigx.ruralLibrary.controller;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.pigx.common.core.util.R;
import com.pig4cloud.pigx.common.log.annotation.SysLog;
import com.pig4cloud.pigx.common.security.annotation.Inner;
import com.pig4cloud.pigx.ruralLibrary.api.entity.BookDataTypeEntity;
import com.pig4cloud.pigx.ruralLibrary.service.BookDataTypeService;
import org.springframework.security.access.prepost.PreAuthorize;
import com.pig4cloud.pigx.common.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import org.springframework.http.HttpHeaders;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 图书大类
 *
 * @author pig
 * @date 2023-09-25 11:09:20
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/bookDataType" )
@Tag(description = "bookDataType" , name = "图书大类管理" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class BookDataTypeController {

    private final  BookDataTypeService bookDataTypeService;

    @Operation(summary = "查询" , description = "查询" )
    @GetMapping("/page" )
    public R getbookDataTypePage() {
        return R.ok(bookDataTypeService.list());
    }

    /**
     * @return R
     */
    @Operation(summary = "同步" , description = "同步" )
    @SysLog("同步" )
    @PostMapping
    public R save() {
        return bookDataTypeService.synchronization();
    }

    @GetMapping("/list")
    @Inner(value = false)
    public R list(){
        return R.ok(bookDataTypeService.list());
    }



}
